package com.eaoa.uc.busroute.bo;

import java.util.Date;

import com.eaoa.base.EABaseBusinessObject;
import com.eaoa.dao.bus.BusRouteDAO;
import com.eaoa.vo.bus.BusRoute;

public class BusRouteModifyBO extends EABaseBusinessObject{
	
	private static BusRouteDAO busRouteDAO = new BusRouteDAO();
	private BusRoute vo ;
	private Long id;
	
	public BusRouteModifyBO(BusRoute vo) {
		super();
		this.vo = vo;
	}

	protected void performBusinessLogic() {
		id = vo.getRouteno();
		
		if(id==null){
			
			vo.setIslock("N");
			vo.setCreatorno(getEmployee().getAccountno());
			vo.setCreatorname(getEmployee().getName());
			vo.setCreatedate(new Date());
			
			id = busRouteDAO.save(vo);
		}else{
			BusRoute po =  (BusRoute)busRouteDAO.loadAndLock(id);
			po.setRoutename(vo.getRoutename());
			po.setRemark(vo.getRemark());
			busRouteDAO.update(po);
		}
		
	}
	
	public Long getRouteno(){
		return id;
	}
}
